package com.jxzyk.http.req;

import android.content.Context;

import com.core.entity.params.ReqParams;
import com.jxzyk.config.API;
import com.jxzyk.http.BaseRequest;
import com.jxzyk.http.Query;

public class CourseRequest extends BaseRequest {

	public CourseRequest(Context context, String url) {
		super(context, url);
	}

	private String type = null;

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Override
	public String getUrl() {
		return getURL();
	}

	@Override
	public ReqParams getParams() {
		Query query = getQuery();
		switch (getURL()) {
		case API.Course.type:
			return params;
		case API.Course.index:
			// params.put("count", count);
			return params;
		case API.Course.getCourses:
			if (query != null) {
				params = query.toParams();
			}
			if (type != null) {
				params.put("type", type);
			}
			return params;
		case API.Course.getOutline:
			return params;
		default:
			return null;
		}
	}

	@Override
	public void setParams(String... value) {
		super.setParams(value);
		switch (getURL()) {
		case API.Course.getOutline:
			params.put("course_id", value[0]);
			break;

		default:
			break;
		}
	}

	@Override
	public OnDialogListener getListener() {
		return null;
	}
}
